<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var str = 'hello'
    // 如果字符串中有匹配的值,则返回该匹配值,否则返回null
    // var pattern = /0/
    var pattern = /o/

    var result = pattern.exec(str)
    console.log(result);
  </script>

</body>

</html>